package com.pro01.tracker.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TorrentMapper {

//    @Select("SELECT id FROM torrents WHERE info_hash = #{infoHash} LIMIT 1")
//    Long getTorrentIdByInfoHash(String infoHash);

    @Select("SELECT id FROM torrents WHERE LOWER(info_hash) = LOWER(#{infoHash}) LIMIT 1")
    Long getTorrentIdByInfoHash(@Param("infoHash") String infoHash);

    @Select("SELECT info_hash FROM torrents")
    List<String> getAllInfoHashes();

}

